# -*- coding: utf-8 -*-
'''
Created on Aug 30, 2011

@author: Reprise
'''
import sys
import ConfigParser
import MySQLdb as mdb
import random
import sys,os

class DbLoad(object):
    '''
    classdocs
    '''


    def __init__(self):
        '''
        Constructor
        '''
    def run(self):
        config = ConfigParser.ConfigParser()
        config.readfp(open(os.path.join(sys.path[0],"app.cfg")))

	instance = config.get("mysqld","instance")
        user = config.get("mysqld","user")
        password = config.get("mysqld","password")
        database = config.get("mysqld","database")

	conn = mdb.connect(instance,user,password,database)
	cursor = conn.cursor()

        for i in range(10000000):
            random.seed()
            hash = random.getrandbits(128)
            #partner = random.randrange(50000,60000)
            #print "i looping %x16" % (hash)
            cursor.execute('Insert into PartnerGateLookup (PartnerID,TrackingURL,Count,FirstOccurance,LastOccurance,LookupStatus) values (50005,UNHEX("%x16"),1,NOW(),NOW(),1)' % (hash))	
       
        cursor.close()
        conn.close()
            
load = DbLoad()
load.run()
